﻿#if DEBUG
using System;
using System.Collections.Generic;
using System.Text;
using CodeGecko.AntiSpam.BlogSpamNet;
using CodeGecko.AntiSpam.BlogSpamNet.Structs;
using NUnit.Framework;

namespace CodeGecko.AntiSpam.BlogSpamNet.Tests {
    [TestFixture]
    public class MyTestClass {
        const string blog = "http://www.benjaminhowarth.com";

        [Test]
        public void TestSpam() {
            BlogSpamNet b = new BlogSpamNet("http://test.blogspam.net:8888/");
            Assert.IsTrue(b.TestComment(
                    new Comment() {
                        comment = "A friend of mine told me about this place. I'm just wondering if this thing works.   You check this posts everyday incase <a href=\"http://someone.finderinn.com\">find someone</a> needs some help?  I think this is a great job! Really nice place http://someone.finderinn.com here.   I found a lot of interesting stuff all around.  I enjoy beeing here and i'll come back soon. Many greetings.",
                        ip = "147.202.45.202",
                        agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)",
                        email = "backthismailtojerry@fastmail.fm",
                        link = "http://someone.finderinn.com",
                        site = blog,
                        name = "someone",
                        version = String.Empty,
                        options = String.Empty,
                        subject = String.Empty
                    }).Substring(0, 4) == "SPAM");
        }

        [Test]
        public void TestHam() {
            BlogSpamNet b = new BlogSpamNet("http://test.blogspam.net:8888/");
            Assert.IsTrue(b.CommentCheck(
                    new Comment() {
                        comment = "Test comment",
                        ip = "127.0.0.1",
                        agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
                        email = "iam@benjaminhowarth.com",
                        link = "http://www.benjaminhowarth.com",
                        site = blog,
                        name = "Benjamin Howarth",
                        version = String.Empty,
                        options = "whitelist=127.0.0.1",
                        subject = String.Empty
                    }));
        }

        [Test]
        public void TestPlugins() {
            BlogSpamNet b = new BlogSpamNet();
            Assert.IsTrue(b.GetPlugins().Length > 0);
        }
    }
}
#endif